<!DOCTYPE html>
<html>
<head>
	<title>用户管理</title>
    <script src="__APP__/js/jquery.js"></script>
    <link rel="stylesheet" href="__APP__/js/bootstrap.min.css"></head>
    <link rel="stylesheet" href="__APP__/js/uploadify.css"></head>
    <script src="__APP__/js/bootstrap.min.js"></script>    
    <script src="__APP__/js/jquery.uploadify.js"></script>
    <style type="text/css">
    a{color: black; text-decoration: none;}
    a:hover{color: red; text-decoration: none;}
    table td{font-size: 16px;text-align: center;margin: 5px;}
    tr{
        height: 26px;
        border-bottom: 1px dashed #cdcdcd;
        line-height: 26px;
        padding-left: 10px;
        font-size: 16px;
    }
    </style>
</head>
<body>
<form method="post" class="lx-table">
                    <table>
                        <a href="__CONTROLLER__/add" class="btn btn-success" style="margin: 10px;">添加</a> 
                        <tr>
                            <td width="6%" align="right" bgcolor="#FFFFFF">id号</td>
							<td width="30%" align="right" bgcolor="#FFFFFF">用户名</td>
                            <td width="10%" align="right" bgcolor="#FFFFFF">状态</td>
							<td width="20%" align="right" headers="22" bgcolor="#FFFFFF">操作</td>
                        </tr>
                        <volist name="admins" id="vo">
                            <tr>
                                
                                <td width="6%" align="right" name="adminid" bgcolor="#FFFFFF">{$vo.adminid}</td>
                                <td width="30%" align="right" bgcolor="#FFFFFF">{$vo.adminusr}</td>

                                <if condition = "$vo[adminstatus] eq 0">
                                    <td><span class="btn btn-danger" onclick="statu(this,{$vo[adminid]},{$vo[adminstatus]})">关闭</span></td>
                                <else />
                                    <td><span class="btn btn-success" onclick="statu(this,{$vo[adminid]},{$vo[adminstatus]})">正常</span></td>
                                </if>
                                <!-- <td width="30%" align="right" bgcolor="#FFFFFF">{$vo.adminstatus|getstatus}</td> -->

                                <td width="20%" align="right" bgcolor="#FFFFFF">
                                <a href="__CONTROLLER__/edit/adminid/{$vo.adminid}" class="btn btn-success">修改</a>
                                <a href="__CONTROLLER__/del/adminid/{$vo.adminid}" class="btn btn-danger">删除</a></td>
                            </tr>
                        </volist>
                    </table>
                    </form>
</body>
<script type="text/javascript">
function statu(obj,id,statu){
    if(statu==1){
        //禁用状态
        $.post("{:U('admin/ajax_statu')}",{adminId:id,adminstatus:'0'},function(data){
            
            // alert(data+"正常");
            if(data==1){
                $(obj).html('关闭');
                $(obj).addClass('btn-danger').removeClass('btn-success');
                $(obj).attr('onclick','statu(this,'+id+',0)');
            }
        });
    }else{
        // 正常状态
        $.post("{:U('admin/ajax_statu')}",{adminId:id,adminstatus:'1'},function(data){
        // alert(data+"禁用");
            if(data==1){
                $(obj).html('正常');
                $(obj).addClass('btn-success').removeClass('btn-danger');
                $(obj).attr('onclick','statu(this,'+id+',1)');
            }
        });
    }
}
</script>
</html>